home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / Tools / Mac / MacMake.rul < prev    next >
Encoding:
Text File  |  1994-04-21  |  13.0 KB  |  342 lines  |  [TEXT/MPS ]

  1. #####################################################################################
  2. # Application
  3. #####################################################################################
  4.  
  5. # (MLH) HACK 8/5/93
  6. #
  7. # Summary:
  8. # Modified the application default link rules to get around an incompatibility
  9. # between jasik's code coverage tool and the way symantec C++ calls static constructors
  10. # and destructors which causes static object constructors and destructors to
  11. # not be called.
  12. #
  13. # Problem:
  14. # The constructors and destructors of a static object are not called when Jasik's
  15. # code cover tool is used on a program compiled with symnatec C++.
  16. #
  17. # Details:
  18. # Currently symantec C++ creates a jump table for the static constructors
  19. # and destructors. The constructors and destructors are mixed together in the
  20. # same table. The code that walks through this table examines the object
  21. # code at each entry to determine if a given entry is for a constructor or a 
  22. # destructor.
  23. #
  24. # Code cover sets a breakpoint at every line of code in the program (there is more to the
  25. # story, but for our purposes this is enough); breakpoints are illegal instructions
  26. # that replace legal instructions. When an illegal instruction is intercepted by
  27. # the the debugger, it replaces it with the original legal instruction and records
  28. # that the line of code has been executed.
  29. #
  30. # The incompatibility between the two systems is caused by code cover modifying
  31. # the code in the entries for the static constructor/destructor table to set break
  32. # points. When symantec C++ examines the object code in the table, it does not
  33. # find the instructions it was expecting so it does not jump through the entry, thus
  34. # no static constructors or destructors are called.
  35. #
  36. # Fix:
  37. # Pat Nelson is aware of the problem and is going to try and modify the C++ runtime
  38. # to static constructor and destructors without looking at object code. In the
  39. # mean time, we can get code cover to not touch the jump table by changing the name
  40. # of the code segment it lives in. Code cover will ignore the code in any segment
  41. # whose name contains the string "_IGNORE". So we rename the segment "__ctordtor" to
  42. # "__ctordtor_IGNORE".
  43. #
  44. # Duration:
  45. # This hack goes away when either Jasik modifies code cover to always ignore
  46. # the segment "__ctordtor" or Pat finds a way to call the static constructors
  47. # and destructors without examining object code.
  48. #
  49. #    -sn __ctordtor=__ctordtor_IGNORE ∂
  50. # (MLH) HACK - Read hack note above
  51. #
  52.  
  53. "{_BedTargetObjectsDir}{__AppName}" ƒƒ ∂
  54.             {__FrameworkObjects} ∂
  55.             {__AppObjects}
  56.     {_BedEcho} {_BedEchoOptions} "Linking:     {__AppName}"
  57.     {_BedLink} ∂
  58.         {_BedLinkOptions} ∂
  59.             -sn __ctordtor=__ctordtor_IGNORE ∂
  60.         {__InitLibs} ∂
  61.         {__FrameworkObjects} ∂
  62.         {__OtherObjects} ∂
  63.         {__AppObjects} ∂
  64.         {__SystemObjects} ∂
  65.         -o "{_BedTargetObjectsDir}{__AppName}"
  66.     {_BedEcho} {_BedEchoOptions} "Creator&Bundle:    {__AppName}"
  67.     CreatorAndBundle ∂
  68.         {_BedCreatorAndBundleOptions} ∂
  69.         "{_BedTargetObjectsDir}{__AppName}"
  70.  
  71. "{_BedTargetObjectsDir}{__AppName}" ƒƒ ∂
  72.             "{_BedTargetObjectsDir}BRResourcesCache.Rsrc"
  73.     {_BedEcho} {_BedEchoOptions} "Merging resources for:    {__AppName}"
  74.     echo "include ∂"{_BedTargetObjectsDir}BRResourcesCache.Rsrc∂";" ∂
  75.         | {_BedRC} -a -o "{_BedTargetObjectsDir}{__AppName}"
  76.         
  77. "{_BedTargetObjectsDir}BRResourcesCache.Rsrc" ƒ ∂
  78.             {__FrameworkResources} ∂
  79.             {__AppResources}
  80.     {_BedEcho} {_BedEchoOptions} "Consolidating framework resources for:    {__AppName}"
  81.     for __resourceFile__ in {__FrameworkResources}
  82.             echo "include ∂"{__resourceFile__}∂";" ∂
  83.                 | {_BedRC} -a -o "{_BedTargetObjectsDir}BRResourcesCache.Rsrc"    
  84.     end
  85.     {_BedEcho} {_BedEchoOptions} "Consolidating application resources for:    {__AppName}"
  86.     for __resourceFile__ in {__AppResources}
  87.         echo "include ∂"{__resourceFile__}∂";" ∂
  88.             | {_BedRC} -a -o "{_BedTargetObjectsDir}BRResourcesCache.Rsrc"    
  89.     end
  90.  
  91. "{_BedTargetObjectsDir}{__AppName}" ƒƒ 
  92.     {_BedEcho} {_BedEchoOptions} " ∂"{_BedTargetObjectsDir}{__AppName}∂"  # <- Execute to run your application"
  93.  
  94.  
  95. #####################################################################################
  96. # MPW Tool
  97. #####################################################################################
  98. "{_BedTargetObjectsDir}{__ToolName}" ƒƒ ∂
  99.             {__ToolObjects}
  100.     {_BedEcho} {_BedEchoOptions} "Linking:     {__ToolName}"
  101.     {_BedLink} ∂
  102.          -t 'MPST' -c 'MPS ' ∂
  103.         {_BedLinkOptions} ∂
  104.         {__InitLibs} ∂
  105.         {__ToolObjects} ∂
  106.         {__SystemObjects} ∂
  107.         -o "{_BedTargetObjectsDir}{__ToolName}"
  108.     {_BedEcho} {_BedEchoOptions} " ∂"{_BedTargetObjectsDir}{__ToolName}∂"  # <- Execute to run your application"
  109.  
  110. "{_BedTargetObjectsDir}{__ToolName}" ƒƒ ∂
  111.             {__ToolResources}
  112.     {_BedEcho} {_BedEchoOptions} "Merging Tool resources for:    {__ToolName}"
  113.     for __resourceFile__ in {__ToolResources}
  114.         echo "include ∂"{__resourceFile__}∂";" ∂
  115.             | {_BedRC} -a -o "{_BedTargetObjectsDir}{__ToolName}"    
  116.     end
  117.  
  118. "{_BedTargetObjectsDir}{__ToolName}" ƒƒ 
  119.     {_BedEcho} {_BedEchoOptions} " ∂"{_BedTargetObjectsDir}{__ToolName}∂"  # <- Execute to run your application"
  120.  
  121.  
  122. #####################################################################################
  123. # Framework
  124. #####################################################################################
  125.  
  126.  
  127. #####################################################################################
  128. # Static Components
  129. #####################################################################################
  130. # Abstract Target dependencies
  131. "{_BedTargetObjectsDir}{__StaticComponentName}" ƒ ∂
  132.             "{_BedLibDir}{__StaticComponentName}.o" ∂
  133.             "{_BedLibDir}{__StaticComponentName}.rsrc" ∂
  134.             {__OtherComponentDependencies}
  135.  
  136.  
  137. # Build the library (.o) file
  138. "{_BedLibDir}{__StaticComponentName}.o" ƒ ∂
  139.             {__ComponentObjects}
  140.     {_BedEcho} {_BedEchoOptions} "Libbing:     {__StaticComponentName}.o"
  141.     {_BedLib} ∂
  142.     {_BedLibOptions} ∂
  143.     {__ComponentObjects} ∂
  144.     -o "{_BedLibDir}{__StaticComponentName}.o"    
  145.         
  146. # Consolidate all the library's resource files into one resource file (LibName.rsrc)
  147. "{_BedLibDir}{__StaticComponentName}.rsrc" ƒ ∂
  148.             {__ComponentResources}
  149.     {_BedEcho} {_BedEchoOptions} "Consolidating resources for:   {__StaticComponentName}"
  150.     for __resourceFile__ in {__ComponentResources}
  151.         echo "include ∂"{__resourceFile__}∂";" ∂
  152.             | {_BedRC} -a -t 'rsrc' -c 'RSED' -o "{_BedLibDir}{__StaticComponentName}.rsrc"    
  153.     end
  154.  
  155.  
  156. #####################################################################################
  157. # Dynamic Components
  158. #####################################################################################
  159. # Abstract Target dependencies
  160. "{_BedTargetObjectsDir}{__DynamicComponentName}" ƒ ∂
  161.             "{_BedTargetObjectsDir}{__DynamicComponentName}ASLM" ∂
  162.             {__OtherComponentDependencies}
  163.     {_BedEcho} {_BedEchoOptions}  Copying up ASLM Library: {Targ}
  164.     duplicate -y "{_BedTargetObjectsDir}{__DynamicComponentName}ASLM" "{BedASLMDir}{__DynamicComponentName}ASLM"
  165.     if "`Exists {_BedTargetObjectsDir}{__DynamicComponentName}ASLM.SYM`"
  166.         duplicate -y "{_BedTargetObjectsDir}{__DynamicComponentName}ASLM.SYM" "{BedASLMDir}{__DynamicComponentName}ASLM.SYM"
  167.     End
  168.  
  169. # Build the library (.o) file
  170. "{_BedTargetObjectsDir}{__DynamicComponentName}.o" ƒ ∂
  171.             {__ExportedComponentObjects}
  172.     {_BedEcho} {_BedEchoOptions} "Libbing:     {__DynamicComponentName}.o"
  173.     {_BedLib} ∂
  174.     {_BedLibOptions} ∂
  175.     {__ExportedComponentObjects} ∂
  176.     -o "{_BedTargetObjectsDir}{__DynamicComponentName}.o"    
  177.  
  178. "{_BedLibDir}{__DynamicComponentName}.cl.o" ƒ ∂
  179.         "{_BedTargetObjectsDir}{__DynamicComponentName}".o ∂
  180.         "{_BedTargetDir}{__DynamicComponentName}".exp
  181.     {_BedEcho} {_BedEchoOptions}  Building: {Targ}
  182.     BuildSharedLibrary ∂
  183.         {__IncludeDirs} ∂
  184.             {__BuildSharedLibraryOptions} ∂
  185.             -exp "{_BedTargetDir}{__DynamicComponentName}".exp ∂
  186.             -obj "{_BedTargetObjectsDir}{__DynamicComponentName}ASLM" ∂
  187.             -far "{_BedLibDir}{__DynamicComponentName}.cl.o" ∂
  188.             "{_BedTargetObjectsDir}{__DynamicComponentName}".o
  189.  
  190. "{_BedTargetObjectsDir}{__DynamicComponentName}Cache.Rsrc" ƒ ∂
  191.             {__FrameworkResources} ∂
  192.             {__ComponentResources}
  193.     {_BedEcho} {_BedEchoOptions} "Consolidating framework resources for:    {__DynamicComponentName}"
  194.     for __resourceFile__ in {__FrameworkResources}
  195.             echo "include ∂"{__resourceFile__}∂";" ∂
  196.                 | {_BedRC} -a -o "{_BedTargetObjectsDir}{__DynamicComponentName}Cache.Rsrc"    
  197.     end
  198.     {_BedEcho} {_BedEchoOptions} "Consolidating Component resources for:    {__DynamicComponentName}"
  199.     for __resourceFile__ in {__ComponentResources}
  200.         echo "include ∂"{__resourceFile__}∂";" ∂
  201.             | {_BedRC} -a -o "{_BedTargetObjectsDir}{__DynamicComponentName}Cache.Rsrc"    
  202.     end
  203.  
  204. "{_BedTargetObjectsDir}{__DynamicComponentName}ASLM" ƒ ∂
  205.         "{_BedTargetObjectsDir}{__DynamicComponentName}Cache.Rsrc" ∂
  206.         "{_BedLibDir}{__DynamicComponentName}.cl.o" ∂
  207.         {__OtherObjects} ∂
  208.         {__OpenDocObjects} ∂
  209.         {__ComponentObjects} ∂
  210.         {__FrameworkObjects}
  211.     {_BedEcho} {_BedEchoOptions}  Linking: {Targ}
  212.     LinkSharedLibrary ∂
  213.             -lib "{_BedTargetObjectsDir}{__DynamicComponentName}ASLM" ∂
  214.             -obj "{_BedTargetObjectsDir}{__DynamicComponentName}ASLM" ∂
  215.             -symfile "{_BedTargetObjectsDir}{__DynamicComponentName}ASLM.SYM" ∂
  216.             {__LinkSharedLibraryOptions} ∂
  217.             "{_BedLibDir}{__DynamicComponentName}.cl.o" ∂
  218.             {__OpenDocObjects} ∂
  219.             {__FrameworkObjects} ∂
  220.             {__ComponentObjects} ∂
  221.             {__OtherObjects} ∂
  222.             {__SystemObjects}
  223.     If "`Exists {_BedTargetObjectsDir}{__DynamicComponentName}Cache.rsrc`"
  224.         {_BedEcho} {_BedEchoOptions} Copying Resources From: "{_BedTargetObjectsDir}{__DynamicComponentName}Cache.rsrc"
  225.         {_BedEcho} {_BedEchoOptions} "include ∂"{_BedTargetObjectsDir}{__DynamicComponentName}Cache.rsrc∂";" | Rez -a -o {Targ}
  226.     End
  227.  
  228. #####################################################################################
  229. # SOM Components
  230. #####################################################################################
  231. # Abstract Target dependencies
  232. "{_BedTargetObjectsDir}{__SOMComponentName}" ƒ ∂
  233.             "{_BedTargetDir}{__SOMComponentName}.lib" ∂
  234.             {__OtherComponentDependencies}
  235.  
  236. "{_BedTargetDir}{__SOMComponentName}.lib" ƒ ∂
  237.             "{_BedTargetObjectsDir}{__SOMComponentName}.seg"
  238.     {_BedEcho} {_BedEchoOptions} Segmenting and Merging Fragments: "{_BedTargetDir}{__SOMComponentName}.lib"
  239.     Seg2Flat "{_BedTargetObjectsDir}{__SOMComponentName}.seg" -o "{_BedTargetDir}{__SOMComponentName}.lib"
  240.     MergeFragment "{_BedTargetDir}{__SOMComponentName}.lib" -cp -t m68k -n "{__SOMComponentName}"
  241.     SetFile -t shlb -c cfmg "{_BedTargetDir}{__SOMComponentName}.lib"
  242.  
  243. "{_BedTargetObjectsDir}{__SOMComponentName}.seg" ƒ ∂
  244.             {__ComponentObjects}
  245.     {_BedEcho} {_BedEchoOptions} ILinking: "{_BedTargetDir}{__SOMComponentName}.seg"
  246.     ILink -model -cfmseg -state nouse -pad 0 -compact -t 'shlb' ∂
  247.         -o "{_BedTargetObjectsDir}{__SOMComponentName}.seg" ∂
  248.         {__ComponentObjects}        ∂
  249.         {SharedLibraries}SOM.slb     ∂
  250.         {NuCLibraries}NuStdCLib.o    ∂
  251.         {NuLibraries}NuMacRuntime.o    ∂
  252.         {NuLibraries}NuIntEnv.o        ∂
  253.         {Libraries}Interface.o        ∂
  254.  
  255.  
  256. #####################################################################################
  257. # Inference Rules
  258. #####################################################################################
  259.  
  260. .a.o    ƒ    .a 
  261.     {_BedEcho} {_BedEchoOptions} "Assembling:     {default}.a"
  262.     {_BedAsm} ∂
  263.         {_BedAsmOptions} ∂
  264.         {__IncludeDirs} ∂
  265.         -o {targDir}{default}.a.o ∂
  266.         {depDir}{default}.a
  267.  
  268.  
  269. .c.o    ƒ    .c 
  270.     {_BedEcho} {_BedEchoOptions} "Compiling:     {default}.c"
  271.     {_BedC} ∂
  272.         {_BedCOptions} ∂
  273.         {__COptions} ∂
  274.         {__IncludeDirs} ∂
  275.         -o {targDir}{default}.c.o ∂
  276.         {depDir}{default}.c
  277.  
  278. .cp.o    ƒ    .cp
  279.     {_BedEcho} {_BedEchoOptions} "Compiling:     {default}.cp"
  280.     {_BedCPlus} ∂
  281.         {_BedCPlusOptions} ∂
  282.         {__CPlusOptions} ∂
  283.         {__IncludeDirs} ∂
  284.         -o {targDir}{default}.cp.o ∂
  285.         {depDir}{default}.cp
  286.  
  287. .cpp.o    ƒ    .cpp
  288.     {_BedEcho} {_BedEchoOptions} "Compiling:     {default}.cpp"
  289.     {_BedCPlus} ∂
  290.         {_BedCPlusOptions} ∂
  291.         {__CPlusOptions} ∂
  292.         {__IncludeDirs} ∂
  293.         -load {__PrecompiledHeaderFile} ∂
  294.         -o {targDir}{default}.cpp.o ∂
  295.         {depDir}{default}.cpp
  296.  
  297. .rsrc    ƒ    .br
  298.     {_BedEcho} {_BedEchoOptions} "BedRC:     {default}.br"
  299.     {_BedBedRC} ∂
  300.         {_BedBedRCOptions} ∂
  301.         {__BedRCIncludeDirs} ∂
  302.         -o "{targDir}{default}.rsrc" ∂
  303.         {depDir}{default}.br
  304.  
  305. .rsrc    ƒ    .r
  306.     {_BedEcho} {_BedEchoOptions} "Rezzing:     {default}.r"
  307.     {_BedRC} ∂
  308.         {_BedRCOptions} ∂
  309.         {__BedRCIncludeDirs} ∂
  310.         {__IncludeDirs} ∂
  311.         -o "{targDir}{default}.rsrc" ∂
  312.         {depDir}{default}.r
  313.  
  314. #####################################################################################
  315. # Maintenance Targets
  316. #####################################################################################
  317.  
  318. "{_BedTargetObjectsDir}"CleanObj    ƒ
  319.     {_BedEcho} {_BedEchoOptions} "Deleting Object Files from:     {_BedTargetObjectsDir}"
  320.     delete -y -i {__ComponentObjects}
  321.  
  322. "{_BedTargetObjectsDir}"CleanRes    ƒ
  323.     {_BedEcho} {_BedEchoOptions} "Deleting Resources from :     {_BedTargetObjectsDir}"
  324.     delete -y -i {__ComponentResources}
  325.         
  326. "{_BedTargetObjectsDir}"CleanLib    ƒ
  327.     {_BedEcho} {_BedEchoOptions} "Deleting Libraries from :     {_BedLibDir}"
  328.     delete -y -i "{_BedLibDir}{__ComponentName}.o"
  329.     delete -y -i "{_BedLibDir}{__ComponentName}.rsrc"
  330.  
  331. "{_BedTargetObjectsDir}"CleanAll    ƒ ∂
  332.     "{_BedTargetObjectsDir}"CleanObjects ∂
  333.     "{_BedTargetObjectsDir}"CleanResources ∂
  334.     "{_BedTargetObjectsDir}"CleanLibs
  335.  
  336. "{_BedTargetObjectsDir}"KillDir    ƒ ∂
  337.     "{_BedTargetObjectsDir}"CleanLibs
  338.     {_BedEcho} {_BedEchoOptions} "Deleting Build Directory:     {_BedTargetObjectsDir}"
  339.     delete -y -i "{_BedTargetObjectsDir}"
  340.     
  341.     
  342.